#pragma once


#define WPGQueryPluginInfo(Info) ((WPGQueryPluginInfo_Proc)((Info)->Proc[0]))
#define WPGNotifyStart(Info) ((OnStart_Proc)((Info)->Proc[1]))
#define WPGNotifyConfig(Info) ((OnConfig_Proc)((Info)->Proc[2]))
#define WPGNotifyStop(Info) ((OnStop_Proc)((Info)->Proc[3]))
typedef void (* WPGQueryPluginInfo_Proc)(char*);//@0
typedef void (* OnStart_Proc)(char*);//@1
typedef void (* OnConfig_Proc)(char*);//@2
typedef void (* OnStop_Proc)(char*);//@3

class PlugInfo
{
public:
	HMODULE hDll;
	CString FileName;
	PlugDetail Detail;
	FARPROC Proc[10];
};


class CPluginManager
{
public:
	CPluginManager(void);
	~CPluginManager(void);
	static CPluginManager* GetInstance();

	void LoadAllPlugin();
	void Init();
	void LoadConfig(PlugInfo* Info);
	void SaveConfig(PlugInfo* Info);
	void ConstructConfig(vector<PlugProp>& Props,CXmlAdapter* Xml);
	int RunPlugin(PlugInfo* Plugin);

	vector<PlugInfo*> m_vctPlugin;
	vector<CWinThread*> m_vctThread;
};
